/**
 * 
 */
package me.myachievements.web.goal;

import java.util.List;

import org.apache.wicket.injection.web.InjectorHolder;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.spring.injection.annot.SpringBean;

import me.myachievements.persistence.goal.Goal;
import me.myachievements.persistence.goal.GoalPersistenceManager;

/**
 * @author besseym
 *
 */
public class GoalListModel extends LoadableDetachableModel<List<Goal>> {
	
	@SpringBean(name="goalPersistenceManager")
	GoalPersistenceManager goalPersistenceManager;
	
	/**
	 * Constructor
	 */
	public GoalListModel() {
		InjectorHolder.getInjector().inject(this);
	}

	/*
	 * (non-Javadoc)
	 * @see org.apache.wicket.model.LoadableDetachableModel#load()
	 */
	@Override
	protected List<Goal> load() {
		return goalPersistenceManager.findAll();
	}

}
